#include "Methods.h"
#include "Character.h"  // 包含Character的完整定义
#include "Monster.h"    // 包含Monster的完整定义
#include "Effect.h"
void Methods::applyRandomEffect(Character& target) const {
    if (effects.empty()) return;

    // 随机选择一个效果
    static std::random_device rd;
    static std::mt19937 gen(rd());
    std::uniform_int_distribution<> dis(0, effects.size() - 1);

    auto effect = effects[dis(gen)];
    effect->apply(target);
}

void Methods::applyEffectById(int effectId, Monster& target) const {
    if (effectId >= 0 && effectId < effects.size()) {
        effects[effectId]->apply(target);
    }
    else {
        std::cout << "无效的效果ID: " << effectId << std::endl;
    }
}

void Methods::applyEffectById(int effectId, Character& target) const {
    if (effectId >= 0 && effectId < effects.size()) {
        effects[effectId]->apply(target);
    }
    else {
        std::cout << "无效的效果ID: " << effectId << std::endl;
    }
}